package com.spx.chapter05.transform;

import com.spx.chapter05.pojo.Event;
import com.spx.util.SampleDataUtil;
import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.List;

/**
 * create by undeRdoG on  2022-04-30  13:48
 * 凡心所向，素履以往，生如逆旅，一苇以航。
 */
public class MapTest {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);

        DataStreamSource<Event> dataStreamSource = env.fromCollection(SampleDataUtil.getSample());

        SingleOutputStreamOperator<String> result = dataStreamSource.map(value -> value.user);

        result.print();

        env.execute();

    }
}
